#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
int n, m;
vector<int> as;
void dfs(int begin)
{
    if (as.size() == m)
    {
        for (auto e : as)
        {
            cout << e << ' ';
        }
        cout << endl;
    }
    for (int i = begin; i <= n; i++)
    {
        as.push_back(i);
        dfs(i + 1);
        as.pop_back();
    }
}
int main()
{
    cin >> n >> m;
    dfs(1);
    return 0;
}